package com.yupi.moonBI.bimq;

import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

@Component
public class MyMessageProducer {
    @Resource
    private RabbitTemplate rabbitTemplate;

    /**
     * @param exchange   交换机名称
     * @param routingKey 路由key
     * @param message    消息内容
     */
    public void sendMessage(String exchange, String routingKey, String message) {
        // 使用convertAndSend方法将消息发送到指定的交换机和路由键
        rabbitTemplate.convertAndSend(exchange, routingKey, message);

    }
}
